package Levels;

import java.awt.Graphics;

import Game.Character;
import Game.Collision;
import Game.Dude;
import Game.Entity;
import Game.IndexCounter;
import Game.Mainth;
import Game.Movement;
import Game.Portal;
import Game.Projectile;
import LifeForms.Chaser;


public class Level1 extends Level{
	Collision coll=new Collision();
	Objects stuff=new Objects();
	Character character=new Character();
	Portal porta;
	Dude dev;
	IndexCounter devIndex;
	IndexCounter bat1Counter;
	Projectile pro;
	Chaser chaser;
	Chaser chaser2;
	
	public Level1() {
		porta=new Portal(Objects.portalSprite,1,245,145);
		porta.setDestanation("level_2");
		portals.add(porta);
		dev=new Dude(character.LinkStandingDown,character.LinkStandingDown.getID(),170,200);
		devIndex=new IndexCounter(1,3);
		chars.add(dev);
		chaser=new Chaser(stuff.batSprite,1,x,y);
		chaser2=new Chaser(stuff.batSprite,1,500,500);
		bat1Counter=new IndexCounter(stuff.batArray.size(),10);
		chasers.add(chaser);
		chasers.add(chaser2);
	}
	void l_update() {
		dev.move();
		devIndex.Counter();
		bat1Counter.Counter();
		movem.movement(dev,character, Mainth.left, Mainth.right, Mainth.up, Mainth.down,Mainth.lastpressedxy,Mainth.lastpressedx,Mainth.lastpressedy,devIndex);
		movem.actions(dev,Mainth.spaceBar,projectiles,stuff.bulletSprite,dev.getX(),dev.getY());
		scrollScreen(dev);
		for(Chaser e:chasers){
			if(e.x>this.x-10&&e.x<this.x+760&&e.y>this.y-10&&e.y<this.y+410){
				e.Chase(dev);
			}
		}
		coll.objectCollision(chars,Objects.objects,xBound,yBound);
		coll.giveCollision(projectiles,Objects.objects, chasers, x, y);
		coll.portalCollision(chars,portals);
		coll.ChaserCollision(chars, chasers);
		Objects.portalIndex.Counter();
	}
	public void l_paint(Graphics g){
		stuff.bush.Draw(g,0,x,y);
		stuff.wall.Draw(g,0,x,y);
		stuff.wall2.Draw(g,0,x,y);
		porta.Draw(g,Objects.portalIndex.getIndex(),x,y);
		dev.Draw(g,devIndex.getIndex(),x,y);
		g.drawString("World 1",10,30);
		for(int i=0;i<chasers.size();i++){
			if(chasers.get(i).x>this.x-10&&chasers.get(i).x<this.x+760&&chasers.get(i).y>this.y-10&&chasers.get(i).y<this.y+410){
				chasers.get(i).Draw(g,bat1Counter.getIndex(),x,y);
			}
		}
		g.drawString("X: "+x,10,45);
		g.drawString("Y: "+y,10,60);
	}
}
